/*
 * Copyright 2004-2006 公司名
 * 本软件及其所有拷贝的名称，与光盘上或本软件中注明的公司同在。
 * 本软件及文档享有版权，并受国家版权法及国际协约条款的保护。
 * 您不可以从本软件中去掉其版权声明；并保证为本软件的拷贝（本部或部分）复制版权声明。
 * 您同意制止以任何形式非法拷贝本软件及文档。
 * 版权信息参见：
 *      http://www.companyname.cn/licenses
 */

package com.companyname.common.sysframe.view.foreveryone;

import java.util.List;
import java.util.Vector;

import org.apache.log4j.Logger;

import com.companyname.common.base.define.FontLayOut;
import com.companyname.common.base.model.BaseObject;
import com.companyname.common.base.web.view.AddFuncButton;
import com.companyname.common.base.web.view.BaseObjectListTemplet;
import com.companyname.common.base.web.view.ConfigColumnFuncButton;
import com.companyname.common.base.web.view.DelFuncButton;
import com.companyname.common.base.web.view.ExportFuncButton;
import com.companyname.common.base.web.view.FuncItem;
import com.companyname.common.base.web.view.Item;
import com.companyname.common.base.web.view.Item4ChangePri;
import com.companyname.common.base.web.view.Item4CheckBox;
import com.companyname.common.base.web.view.Item4Remark;
import com.companyname.common.base.web.view.PrintFuncButton;
import com.companyname.common.base.web.view.QueryFuncButton;
import com.companyname.common.base.web.view.Title;
import com.companyname.common.base.web.view.Title4CheckBox;
import com.companyname.common.base.web.view.Title4Remark;
import com.companyname.common.base.web.view.Title4Sort;
import com.companyname.common.base.web.view.Title4SortPri;
import com.companyname.common.base.web.view.UpdateFuncButton;
import com.companyname.common.sysframe.model.Org;

/**
 * <p>Title: 机构结果列表 </p>
 * <p>Description: 机构结果列表 Org </p>
 * <p>Copyright: Copyright (c) 2004-2006</p>
 * <p>Company: 公司名</p>
 * @ $Author: 作者名 $
 * @ $Date: 创建日期 $
 * @ $Revision: 1.0 $
 * @ created in 创建日期
 *
 */

public class OrgList4EveryOne extends BaseObjectListTemplet
{
        static Logger logger = Logger.getLogger(OrgList4EveryOne.class);

        /** 功能按钮区 */
        public List getButtons(String contextPath)
        {
                List fbs = new Vector();
                // new Add、Update、Del、Query、Print、COnfigColumnFuncButton(onclick事件函数名) (按钮显示文本,onclick事件函数名)
                fbs.add(new AddFuncButton());
                fbs.add(new UpdateFuncButton());
                fbs.add(new DelFuncButton());
                fbs.add(new QueryFuncButton());
                fbs.add(new ExportFuncButton());
                fbs.add(new PrintFuncButton());
                fbs.add(new ConfigColumnFuncButton());
                return fbs;
        }

        /** 功能切换区 */
        public List getChanges(String contextPath)
        {
                List fis = new Vector();
                // new FuncItem(功能切换名,是否聚焦,onclick对应函数名);
                fis.add(new FuncItem("机构",true));
                return fis;
        }

        /** 明细标题区 */
        public List getTitles(String contextPath)
        {
                List titles = new Vector();
                titles.add(new Title4CheckBox());
                titles.add(new Title4Sort("父机构","org.superOrg.id"));
                titles.add(new Title4Sort("代码","org.id"));
                titles.add(new Title4Sort("名称","org.name"));
                titles.add(new Title4SortPri("org.pri"));
                titles.add(new Title("授权",false));
                titles.add(new Title4Sort("国家","org.country"));
                titles.add(new Title4Sort("省","org.province"));
                titles.add(new Title4Sort("市","org.city"));
                titles.add(new Title4Sort("街道","org.street"));
                titles.add(new Title4Sort("房号","org.office"));
                titles.add(new Title4Sort("联系人","org.linkMan"));
                titles.add(new Title4Sort("电话","org.phone"));
                titles.add(new Title4Sort("传真","org.fax"));
                titles.add(new Title("主页",false));
                titles.add(new Title4Sort("email","org.email"));
                titles.add(new Title4Remark());
                return titles;
        }

        /** 明细区 */
        public List getItems(String contextPath,BaseObject model)
        {
                Org org = (Org)model;
                List items = new Vector();
                items.add(new Item4CheckBox(org.getId()));
                if(org.getSuperOrg() != null)
                {
                        items.add(new Item(org.getSuperOrg().getName()));
                }
                else
                {
                        items.add(new Item(""));
                }
                items.add(new Item(org.getCode()));
                items.add(new Item(org.getName()));
                items.add(new Item4ChangePri(model));
                items.add(new Item("<font color='red'>详细</font>",
                                   "showViews2Unit('"+ org.getId()  +"');").setLength(2)
                                                                           .setXLayOut(FontLayOut.CENTER)
                                                                           .setPrinted(false));
                items.add(new Item(org.getCountry()));
                items.add(new Item(org.getProvince()));
                items.add(new Item(org.getCity()));
                items.add(new Item(org.getStreet()));
                items.add(new Item(org.getOffice()));
                items.add(new Item(org.getLinkMan()));
                items.add(new Item(org.getPhone()));
                items.add(new Item(org.getFax()));
                items.add(new Item("<a href='" + org.getSite() + "' title='" + org.getSite() + "' target='_blank'>浏览</a>").setPrinted(false));
                items.add(new Item(org.getEmail()));
                items.add(new Item4Remark(org.getRemark()));
                return items;
        }
}
